package com.vidmt.api.common.exceptions;

public class CodeException extends Exception {
	private static final long serialVersionUID = 1L;

	protected static final int ERR_UNKNOWN = 1;
	protected static final int ERR_INVALID_PARAM = 2;

	protected static final int ERR_USER_NOT_LOGIN = 101;
	protected static final int ERR_USER_ALREADY_EXISTS = 102;
	protected static final int ERR_USER_NOT_EXISTS = 103;

	private int code;

	public CodeException() {
		this(ERR_UNKNOWN);
	}

	public CodeException(Throwable e) {
		this(ERR_UNKNOWN, e);
	}

	public CodeException(int code) {
		this.code = code;
	}

	public CodeException(int code, String msg) {
		super(msg);
		this.code = code;
	}

	public CodeException(int code, Throwable e) {
		super(e);
		this.code = code;
	}

	public int getCode() {
		return code;
	}

}
